/*
 * @Author: Bennent_G
 * @Date: 2024-12-23 16:14:13
 * @LastEditTime: 2025-01-14 16:28:50
 * @Description:
 */
import { defineConfig, loadEnv } from 'vite';
import { viteMockServe } from 'vite-plugin-mock';
import vue from '@vitejs/plugin-vue';
import path from 'path';

// https://vite.dev/config/
export default defineConfig(({mode}) => {
	const env = loadEnv(mode, process.cwd());

	return {
		plugins: [
			vue(),
			viteMockServe({
				mockPath: 'mock', // mock文件夹路径
				enable: !env.VITE_SERVER_MODE // 只有开发环境才开启mock
			}),
		],
		resolve: {
			alias: {
				'@': path.resolve(__dirname, './src'),
			},
		},
	};
});
